package com.imooc.coupon.feign.hystrix;

import com.imooc.coupon.feign.TemplateClient;
import com.imooc.coupon.vo.CommonResponse;
import com.imooc.coupon.vo.CouponTemplateSDK;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;

import java.util.*;

/**
 * 优惠券模板Feign接口的熔断降级策略
 * @Author Administrator
 * @Date 2021/11/11 22:34
 * @Version 1.0
 */
@Slf4j
@Component
public class TemplateClientHystrix implements TemplateClient {


    @Override
    public CommonResponse<List<CouponTemplateSDK>> findAllUsableTemplate() {
        log.error("[eureka-client-coupon-template] findAllUsableTemplate request error");
        return new CommonResponse(-1,
                "[eureka-client-coupon-template] findAllUsableTemplate request error",
                Collections.EMPTY_LIST);
    }

    @Override
    public CommonResponse<Map<Integer, CouponTemplateSDK>> findIds2TempklateSDK(Collection<Integer> ids) {
        log.error("[eureka-client-coupon-template] findIds2TempklateSDK request error");
        return new CommonResponse(-1,
                "[eureka-client-coupon-template] findIds2TempklateSDK request error",
                new HashMap<>());
    }
}
